package com.fox0g.util;

import java.math.BigDecimal;

/**
 * @program: finalTemplate
 * @Date: 2023-03-17 11:54
 * @author: Fox0g
 * @description: TODO
 */
public class MathsUtils {

    public static String jian(String x1, String x2){
        BigDecimal subtract = new BigDecimal(x1).subtract(new BigDecimal(x2));
        String x = subtract.toString();
//        if(x1.length()>x.length()){
//            x="0"+x;
//        }
        return x;
    }

    public static String jia(String x1,String x2){
        BigDecimal subtract = new BigDecimal(x1).add(new BigDecimal(x2));
        return subtract.toString();
    }

    public static String chu(String x1,String x2){
        BigDecimal subtract = new BigDecimal(x1).divide(new BigDecimal(x2),BigDecimal.ROUND_CEILING);
        return subtract.toString();
    }

    public static String cheng(String x1,String x2){
        BigDecimal subtract = new BigDecimal(x1).multiply(new BigDecimal(x2));
        return subtract.toString();
    }

    public static void main(String[] args) {
        String jian = MathsUtils.chu("2.00", "1.10");
        Double x = Double.parseDouble("2.00")-Double.parseDouble("1.10");
        System.out.println(jian);
        System.out.println(x);
    }
}
